﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Microsoft.Windows.UserControls"
                    xmlns:commands="clr-namespace:Microsoft.Windows.UserControls.Core.Commands">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Microsoft.Windows.UserControls.Wpf;component/Themes/DefaultColors.xaml"/>
        <ResourceDictionary Source="pack://application:,,,/Microsoft.Windows.UserControls.Wpf;component/Themes/Common.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type local:WizardPage}">
        <Setter Property="Background" Value="{StaticResource ControlBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ControlDarkBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource ControlTextBrush}"/>
        <Setter Property="BorderThickness" Value="{StaticResource ControlWithoutBorderThickness}"/>
        <Setter Property="PageHeaderBackground" Value="{StaticResource InactiveCaptionBrush}"/>
        <Setter Property="PageIndexBackground" Value="{StaticResource InfoBrush}"/>
        <Setter Property="PageNavigationBackground" Value="{StaticResource ActiveCaptionBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:WizardPage}">
                    <Border SnapsToDevicePixels="true" 
                            Margin="{TemplateBinding Margin}"
                            Padding="{TemplateBinding Padding}"
                            Background="{TemplateBinding Background}" 
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            BorderBrush="{TemplateBinding BorderBrush}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <ContentPresenter x:Name="PART_ContentPresenter" 
                                              Grid.Row="1"
                                              Grid.Column="1"
                                              Content="{TemplateBinding Content}" 
                                              ContentTemplate="{TemplateBinding ContentTemplate}" 
                                              ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />

                            <Border x:Name="PART_PageHeader"
                                    Grid.Row="0"
                                    Grid.Column="1"
                                    MinHeight="60"
                                    SnapsToDevicePixels="true" 
                                    Background="{TemplateBinding PageHeaderBackground}"
                                    BorderBrush="{TemplateBinding PageHeaderBackground}"
                                    BorderThickness="{StaticResource ControlWithoutBorderThickness}">
                                <Grid MinHeight="60">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <StackPanel Grid.Column="0" >
                                        <TextBlock Margin="6" TextWrapping="NoWrap" FontSize="16" FontWeight="Bold" Text="{TemplateBinding PageHeaderTitle}" />
                                        <TextBlock Margin="6,0,6,6" TextWrapping="Wrap" Text="{TemplateBinding PageHeaderDescription}" />
                                    </StackPanel>

                                    <Image Grid.Column="1"
                                           Height="60"
                                           Width="60"
                                           Source="{TemplateBinding PageHeaderImage}"
                                           Stretch ="Fill"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center" />
                                </Grid>
                            </Border>

                            <Border x:Name="PART_PageIndex"
                                    Grid.Row="0"
                                    Grid.Column="0"
                                    Grid.RowSpan="2"
                                    MinWidth="150"
                                    SnapsToDevicePixels="true"
                                    Background="{TemplateBinding PageIndexBackground}"
                                    BorderBrush="{TemplateBinding PageIndexBackground}"
                                    BorderThickness="{StaticResource ControlWithoutBorderThickness}"
                                    Visibility="{TemplateBinding PageIndexVisibility}">

                                <ContentPresenter Content="{TemplateBinding PageIndexContent}" 
                                                  TextElement.Foreground="{TemplateBinding Foreground}"/>

                            </Border>

                            <Border x:Name="PART_PageNavigation"
                                    Grid.Row="2"
                                    Grid.Column="0"
                                    Grid.ColumnSpan="2"
                                    SnapsToDevicePixels="true" 
                                    Padding="6"
                                    Background="{TemplateBinding PageNavigationBackground}"
                                    BorderBrush="{TemplateBinding PageNavigationBackground}"
                                    BorderThickness="{StaticResource ControlWithoutBorderThickness}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>

                                    <local:WizardButton x:Name="PART_ButtonHelp"
                                                        Grid.Column="0"
                                                        CommandType="Help"
                                                        Visibility="{Binding Navigation.Help.Visibility}">
                                    </local:WizardButton>

                                    <StackPanel Grid.Column="1"
                                                Orientation="Horizontal"
                                                HorizontalAlignment="Right">

                                        <local:WizardButton x:Name="PART_ButtonPrevious"
                                                            CommandType="Previous"
                                                            Visibility="{Binding Navigation.Previous.Visibility}"
                                                            Margin="0">
                                        </local:WizardButton>

                                        <local:WizardButton x:Name="PART_ButtonNext"
                                                            CommandType="Next"
                                                            Visibility="{Binding Navigation.Next.Visibility}"
                                                            Margin="0" >
                                        </local:WizardButton>

                                        <local:WizardButton x:Name="PART_ButtonCancel"
                                                            CommandType="Cancel"
                                                            Visibility="{Binding Navigation.Cancel.Visibility}"
                                                            Margin="0">
                                        </local:WizardButton>

                                        <local:WizardButton x:Name="PART_FinishButton"
                                                            CommandType="Finish"
                                                            Visibility="{Binding Navigation.Finish.Visibility}"
                                                            Margin="0" >
                                        </local:WizardButton>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="PageType" Value="Welcome">
                            <Setter TargetName="PART_PageIndex" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="PageType" Value="Completion" >
                            <Setter TargetName="PART_PageIndex" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="PageType" Value="Normal"/>
                                <Condition Property="PageIndexVisibility" Value="Visible"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.Setters>
                                <Setter TargetName="PART_PageIndex" Property="Visibility" Value="Visible"/>
                            </MultiTrigger.Setters>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>